import React from 'react'

const Todoitem = (props) => {
    
    // console.log(props)
    const {
        title,
        completed
    } = props
    
    console.log('TodoItem is render')
    const handleClickDelete = ()=>{
        props.deleteTodo && props.deleteTodo(props.id)
    }

    return (
        <li>
            <span>{title}  {completed ? '已完成': '未完成'}</span>
            &nbsp;
            <button onClick={handleClickDelete}> 点击删除 </button>
        </li>
    )
}

export default Todoitem
